<template>
	<div>
		<el-row style="padding: 10px;">
			<el-col :span="24">
				<el-timeline :reverse="false">
					<el-timeline-item v-for="(userTrainingRecord, index) in userTrainingRecordList" :key="index">
						<div>
							培训时间：{{userTrainingRecord.trainStartDate}}至{{userTrainingRecord.trainEndDate}}
						</div>
						<div>
							培训主题：{{userTrainingRecord.trainTitle}} (主讲人：{{userTrainingRecord.master}})
						</div>
						<div>
							签到时间：{{userTrainingRecord.startDate}}
						</div>
						<div v-if="userTrainingRecord.endDate !=null">
							签出时间：{{userTrainingRecord.endDate}}
						</div>
					</el-timeline-item>
				</el-timeline>
			</el-col>
		</el-row>
	</div>
</template>

<script>
	import { trainingRecordAndTrainList } from "@/api/system/userTrainingRecord";

	export default {
		name: "UserTrainingRecord",
		props: {
			userModel: {
				type: Object
			},
		},
		components: {},
		data() {
			return {
				// 查询参数
				queryParams: {
					pageNum: 1,
					pageSize: 10,
					userId: null,
					trainId: null,
					startDate: null,
					endDate: null
				},
				userTrainingRecordList: []
			};
		},
		created() {
			this.queryParams.userId = this.userModel.userId
			this.getList();
		},
		methods: {
			/** 查询用户培训记录列表 */
			getList() {
				trainingRecordAndTrainList(this.queryParams).then(response => {
					this.userTrainingRecordList = response.data;
				});
			}
		},
	};
</script>